package net.golfklubi.sive;

import org.apache.wicket.Page;
import org.apache.wicket.authentication.AuthenticatedWebApplication;
import org.apache.wicket.authentication.AuthenticatedWebSession;
import org.apache.wicket.injection.web.InjectorHolder;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
import org.apache.wicket.util.time.Duration;

public class SiveApplication extends AuthenticatedWebApplication {

    @SpringBean
    XStreamFactory xStreamFactory;

    @Override
    public Class<? extends Page> getHomePage() {
        return SiveHomePage.class;
    }

    @Override
    protected void init() {
        addComponentInstantiationListener(new SpringComponentInjector(this));
        getSecuritySettings().setAuthorizationStrategy(new SiveStrategy());
        getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND);
        InjectorHolder.getInjector().inject(this);
        xStreamFactory.init();
    }

    @Override
    protected Class<? extends WebPage> getSignInPageClass() {
        return SiveLoginPage.class;
    }

    @Override
    protected Class<? extends AuthenticatedWebSession> getWebSessionClass() {
        return SiveWebSession.class;
    }

}
